<template>
  <div class="home-page">
    <el-row :gutter="20">
      <el-col :span="24">
        <el-card>
          <template #header>
            <div class="card-header">
              <h2>欢迎使用Vue3管理系统</h2>
            </div>
          </template>
          <div class="welcome-content">
            <el-alert
              title="系统提示"
              type="success"
              description="欢迎使用Vue3+Vite+ElementPlus构建的管理系统模板！"
              :closable="false"
              show-icon
            />
            <div class="stats-cards">
              <el-row :gutter="20" class="mt-4">
                <el-col :span="6" v-for="(item, index) in statCards" :key="index">
                  <el-card shadow="hover" class="stat-card">
                    <div class="stat-icon" :style="{ backgroundColor: item.color }">
                      <el-icon><component :is="item.icon" /></el-icon>
                    </div>
                    <div class="stat-info">
                      <div class="stat-value">{{ item.value }}</div>
                      <div class="stat-label">{{ item.label }}</div>
                    </div>
                  </el-card>
                </el-col>
              </el-row>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
    
    <el-row :gutter="20" class="mt-4">
      <el-col :span="16">
        <el-card>
          <template #header>
            <div class="card-header">
              <h3>项目信息</h3>
            </div>
          </template>
          <el-descriptions :column="2" border>
            <el-descriptions-item label="项目名称">Vue3 Admin Template</el-descriptions-item>
            <el-descriptions-item label="版本">1.0.0</el-descriptions-item>
            <el-descriptions-item label="技术栈">Vue3 + Vite + ElementPlus</el-descriptions-item>
            <el-descriptions-item label="依赖管理">npm</el-descriptions-item>
            <el-descriptions-item label="状态管理">Pinia</el-descriptions-item>
            <el-descriptions-item label="路由">Vue Router</el-descriptions-item>
          </el-descriptions>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <template #header>
            <div class="card-header">
              <h3>快速导航</h3>
            </div>
          </template>
          <div class="quick-nav">
            <el-button type="primary" @click="router.push('/about')">关于页面</el-button>
            <el-button type="success" @click="router.push('/products-list')">产品列表</el-button>
            <el-button type="warning" @click="router.push('/products-create')">新增产品</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { User, ShoppingCart, Goods, Money } from '@element-plus/icons-vue'

const router = useRouter()

const statCards = ref([
  { label: '用户数量', value: '1,234', icon: 'User', color: '#409EFF' },
  { label: '订单数量', value: '456', icon: 'ShoppingCart', color: '#67C23A' },
  { label: '产品数量', value: '89', icon: 'Goods', color: '#E6A23C' },
  { label: '总收入', value: '¥12,345', icon: 'Money', color: '#F56C6C' }
])
</script>

<style scoped lang="scss">
.home-page {
  padding: 20px;
}

.mt-4 {
  margin-top: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.welcome-content {
  .stats-cards {
    margin-top: 20px;
  }
}

.stat-card {
  display: flex;
  align-items: center;
  
  .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    
    .el-icon {
      font-size: 24px;
      color: white;
    }
  }
  
  .stat-info {
    .stat-value {
      font-size: 24px;
      font-weight: bold;
      line-height: 1.2;
    }
    
    .stat-label {
      color: var(--el-text-color-secondary);
      font-size: 14px;
    }
  }
}

.quick-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
</style>